home *** CD-ROM | disk | FTP | other *** search
/ Champak 138 / Volume 138 Aug 19 2011 - Damaged.iso / Games / shadez.swf / scripts / Local / Game / Thing / CVehicleScudLauncher.as < prev    next >
Encoding:
Text File  |  2011-08-19  |  6.7 KB  |  267 lines

  1. package Local.Game.Thing
  2. {
  3.    import Local.Game.World.*;
  4.    import Local.Game.World.Map.*;
  5.    import Local.Game.World.Map.Cell.*;
  6.    import Local.Math.*;
  7.    import STC9.System.*;
  8.    import flash.display.*;
  9.    import flash.events.*;
  10.    import flash.geom.*;
  11.    
  12.    public class CVehicleScudLauncher extends CVehicle
  13.    {
  14.        
  15.       
  16.       private var mScudMissile:CThingAnimation;
  17.       
  18.       private var mRaiseCount:Number;
  19.       
  20.       private var mTrackSoundID:String;
  21.       
  22.       private var mTargetPosition:CPosition;
  23.       
  24.       public function CVehicleScudLauncher(param1:CPosition)
  25.       {
  26.          super(param1);
  27.          mType = "scudlauncher";
  28.          Process = Process_Normal;
  29.          mMaxSpeed = 4 * mSpriteScalar;
  30.          mMaxLife = mLife = 100;
  31.          mSpeed = 0;
  32.          mAcceleration = 0.1;
  33.          zDepth -= 10;
  34.          mOrientation = -1;
  35.          SetTargetting(2000 - Math.random() * 500,false,FILTER_GroundTargets,false,800);
  36.          AddAnimation("stand",ScudLauncher,"AddSprite_Black",true);
  37.          SetCollisionBySprite(mAnimation[0]);
  38.          CompileNodes();
  39.          SetState("GOTO");
  40.          AddThing(mScudMissile = new CThingAnimation(ScudMissile,"AddSprite_Black"));
  41.          mScudMissile.mOrientation = mOrientation;
  42.          mScudMissile.zDepth = zDepth;
  43.          IncrementBuild();
  44.       }
  45.       
  46.       public function State_MOUSEOVER_Enter() : void
  47.       {
  48.       }
  49.       
  50.       override public function Dispose() : void
  51.       {
  52.          if(true)
  53.          {
  54.             if(mDisposed)
  55.             {
  56.                if(true)
  57.                {
  58.                   return;
  59.                }
  60.                addr30:
  61.                StopSound(mTrackSoundID);
  62.             }
  63.             else
  64.             {
  65.                super.Dispose();
  66.                if(mTrackSoundID != "")
  67.                {
  68.                   ┬º┬ºgoto(addr30);
  69.                }
  70.             }
  71.          }
  72.       }
  73.       
  74.       public function State_GOTO_Exit() : void
  75.       {
  76.       }
  77.       
  78.       public function State_RAISESCUD() : void
  79.       {
  80.          var _loc1_:Number = NaN;
  81.          _loc1_ = 0.2 * mEnemySpeed;
  82.          ┬º┬ºpush(┬º┬ºfindproperty(mRaiseCount));
  83.          ┬º┬ºpush(mRaiseCount);
  84.          if(true)
  85.          {
  86.             ┬º┬ºpush(┬º┬ºpop() + _loc1_);
  87.          }
  88.          ┬º┬ºpop().mRaiseCount = ┬º┬ºpop();
  89.          ┬º┬ºpush(mScudMissile);
  90.          if(true)
  91.          {
  92.             ┬º┬ºpop().mAngle.mAngleDEG = mScudMissile.mAngle.mAngleDEG + _loc1_;
  93.             ┬º┬ºpush(mScudMissile);
  94.          }
  95.          if(┬º┬ºpop().mAngle.mAngleDEG >= 50)
  96.          {
  97.             SetState("LAUNCHSCUD");
  98.          }
  99.       }
  100.       
  101.       public function State_MOUSEOVER_Exit() : void
  102.       {
  103.       }
  104.       
  105.       public function State_LAUNCHSCUD_Exit() : void
  106.       {
  107.       }
  108.       
  109.       public function State_GOTO() : void
  110.       {
  111.          if((mCurrentTarget = GetTarget()) != null)
  112.          {
  113.             SetState("RAISESCUD");
  114.             return;
  115.          }
  116.          VehicleMove();
  117.          if(mDisposed)
  118.          {
  119.             return;
  120.          }
  121.          ┬º┬ºpush(mScudMissile);
  122.          if(true)
  123.          {
  124.             ┬º┬ºpop().mPosition.Copy(OrientatePoint(mSprite.mObjects["scud"].mPosition.clone(),mPosition));
  125.             ┬º┬ºpush(mScudMissile);
  126.          }
  127.          ┬º┬ºpop().mAngle.Copy(mAngle);
  128.          mCollide.Update();
  129.       }
  130.       
  131.       public function State_RAISESCUD_Enter() : void
  132.       {
  133.          mRaiseCount = 0;
  134.          AddLoopingSound("raise",Scud_Raise);
  135.          mTrackSoundID = PlaySound("raise");
  136.          mTargetPosition = mCurrentTarget.mPosition;
  137.       }
  138.       
  139.       public function State_RELOADSCUD() : void
  140.       {
  141.          if(true)
  142.          {
  143.             if(mStateCount <= 0)
  144.             {
  145.                SetState("GOTO");
  146.             }
  147.          }
  148.       }
  149.       
  150.       public function State_MOUSEOVER() : void
  151.       {
  152.          if(true)
  153.          {
  154.             ┬º┬ºpush(mStateCount < 0);
  155.             if(mStateCount < 0)
  156.             {
  157.                ┬º┬ºpop();
  158.                if(true)
  159.                {
  160.                   addr28:
  161.                   if(mMouseOver)
  162.                   {
  163.                   }
  164.                   ┬º┬ºgoto(addr32);
  165.                }
  166.                SetState(mReturnStateID);
  167.                addr32:
  168.                return;
  169.             }
  170.          }
  171.          ┬º┬ºgoto(addr28);
  172.       }
  173.       
  174.       public function State_LAUNCHSCUD_Enter() : void
  175.       {
  176.          StopSound(mTrackSoundID);
  177.          mTrackSoundID = "";
  178.          AddSound("fire",Scud_Fire);
  179.          PlaySound("fire");
  180.       }
  181.       
  182.       public function State_RELOADSCUD_Exit() : void
  183.       {
  184.          mScudMissile.mAngle.Copy(mAngle);
  185.          mScudMissile.mInvisible = false;
  186.       }
  187.       
  188.       public function State_GOTO_Enter() : void
  189.       {
  190.       }
  191.       
  192.       override public function Draw() : void
  193.       {
  194.          var _loc1_:Matrix = null;
  195.          if(true)
  196.          {
  197.             super.Draw();
  198.          }
  199.          _loc1_ = GetOrientationMatrix();
  200.          if(true)
  201.          {
  202.             DrawSprite(_loc1_);
  203.             mScudMissile.Draw();
  204.          }
  205.       }
  206.       
  207.       public function Process_Normal() : void
  208.       {
  209.          if(true)
  210.          {
  211.             if(Process_State != null)
  212.             {
  213.                if(true)
  214.                {
  215.                   Process_State();
  216.                   if(true)
  217.                   {
  218.                      addr27:
  219.                      Process_Children();
  220.                   }
  221.                   if(mDead)
  222.                   {
  223.                   }
  224.                   ┬º┬ºgoto(addr33);
  225.                }
  226.                DispatchDispose();
  227.                ┬º┬ºgoto(addr33);
  228.             }
  229.             ┬º┬ºgoto(addr27);
  230.          }
  231.          addr33:
  232.       }
  233.       
  234.       override public function get mPrize() : int
  235.       {
  236.          return CPeepM16.mCost * 50;
  237.       }
  238.       
  239.       public function State_LAUNCHSCUD() : void
  240.       {
  241.          mScudMissile.mInvisible = true;
  242.          AddThing(new CShotScud(mScudMissile.mPosition.Clone(),mScudMissile.mAngle.Clone(),mTargetPosition));
  243.          SetState("RELOADSCUD");
  244.       }
  245.       
  246.       public function State_RELOADSCUD_Enter() : void
  247.       {
  248.          ┬º┬ºpush(┬º┬ºfindproperty(mStateCount));
  249.          ┬º┬ºpush(SECONDS * 4);
  250.          if(true)
  251.          {
  252.             ┬º┬ºpush(┬º┬ºpop() / mEnemySpeed);
  253.          }
  254.          ┬º┬ºpop().mStateCount = ┬º┬ºpop();
  255.       }
  256.       
  257.       public function State_RAISESCUD_Exit() : void
  258.       {
  259.       }
  260.       
  261.       override public function get mBaseDamage() : Number
  262.       {
  263.          return 500;
  264.       }
  265.    }
  266. }
  267.